# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dexpatcher
pkgver=1.7.0
pkgrel=1
pkgdesc='Modify Android DEX/APK files at source-level using Java.'
groups=('blackarch' 'blackarch-mobile' 'blackarch-binary')
arch=('any')
url='https://github.com/DexPatcher/dexpatcher-tool'
license=('GPL3')
depends=('java-environment')
makedepends=('git')
noextract=("dexpatch-$pkgver.jar")
source=("https://github.com/DexPatcher/$pkgname-tool/releases/download/v$pkgver/$pkgname-$pkgver.jar")
sha512sums=('7ef8b1d6566a83c5fc536e4a6933617dac6c9fe3ba40669a10107c7258f65f0150bc96cdfcb8d0d17ea4ba584d13523f0df8f363bd84806ed9b51afa06d86036')

package() {
  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 644 "$pkgname-$pkgver.jar" \
    "$pkgdir/usr/share/dexpatcher/dexpatcher-$pkgver.jar"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec java -jar /usr/share/$pkgname/$pkgname-$pkgver.jar "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

